package proxy;

import java.lang.reflect.Proxy;

/**
 * Created by luzl on 4/8/2017.
 */
public class Main {
    public static void main(String[] args){
        StaticAgent agent=new StaticAgent();
        agent.sell();

        DynamicAgent dynamicSellAgent=new DynamicAgent(new Vendor());
        Sell sell=(Sell) Proxy.newProxyInstance(
                Sell.class.getClassLoader(),
                new Class[]{Sell.class},
                dynamicSellAgent);
        sell.sell();
    }
}
